<?php

namespace Biz\service\BrandRemind;

use Doraemon\tools\Log;

class BrandRemind
{
    private $observers = [];

    public function add(IObserver $observer)
    {
        $this->observers[] = $observer;
    }

    public function notify()
    {
        foreach ($this->observers as $observer) {
            try {
                $observer->notify();
            } catch (\Exception $e) {
                Log::error('notify error', [
                    'className' => get_class($observer),
                    'params' => $observer->getParam(),
                    'error' => $e->getMessage()
                ]);
            }
        }
    }
}